package com.feather.common.converter.simple;

import com.feather.common.converter.ArrayIndex;
import com.feather.common.converter.NameMatch;
import com.feather.common.converter.simple.namematch.NameMatch__;
import com.feather.common.converter.simple.namematch.NameMatch__Array;
import com.feather.common.converter.simple.namematch.NameMatch__Array_CaseMatch;
import com.feather.common.converter.simple.namematch.NameMatch__CaseMatch;
import com.feather.common.converter.simple.namematch.NameMatch__Prefix;
import com.feather.common.converter.simple.namematch.NameMatch__Prefix_Array;
import com.feather.common.converter.simple.namematch.NameMatch__Prefix_Array_CaseMatch;
import com.feather.common.converter.simple.namematch.NameMatch__Prefix_CaseMatch;

/**
 * @author flogyin
 */
public class SimpleNameMatch {
	private SimpleNameMatch() {
	}

	public static NameMatch getNameMatch(boolean caseMatch, String prefix) {
		return getNameMatch(caseMatch, prefix, null);
	}

	public static NameMatch getNameMatch(boolean caseMatch, String prefix, ArrayIndex arrayindex) {
		if (arrayindex == null) {
			if (prefix != null && prefix.length() > 0)
				return caseMatch ? NameMatch__Prefix_CaseMatch.instance() : NameMatch__Prefix.instance();
			else
				return caseMatch ? new NameMatch__CaseMatch() : new NameMatch__();
		} else {
			if (prefix != null && prefix.length() > 0)
				return caseMatch ? NameMatch__Prefix_Array_CaseMatch.instance() : NameMatch__Prefix_Array.instance();
			else
				return caseMatch ? NameMatch__Array_CaseMatch.instance() : NameMatch__Array.instance();
		}
	}
}
